<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/jsp/comm_css_include.jsp"%>
<link
	href="${basePath}/css/plugins/jqgriddemo/css/ui.jqgrid-bootstrap.min.css"
	rel="stylesheet" />
<!doctype html>
<html>
<head>
<style type="text/css">
.ibox-content {
	border: none;
}
</style>
</head>
<body class="gray-bg">
	<div class="container creditbody">
		<div class="iboxtitle">
			<span><i class="glyphicon glyphicon-map-marker"></i>&nbsp;&nbsp;贷后业务&nbsp;&gt;&nbsp;逾期风控&nbsp;&gt;&nbsp;拖车处理</span>
		</div>


		<div class="ibox-content">
			<div class="jqGrid_wrapper">
				<table id="table_list_1"></table>
				<div id="pager_list_1"></div>
			</div>
		</div>

		<div id="contractDiv" style="display: none;">
			<form class="form-horizontal" id="">
				<table cellpadding="0" cellspacing="0" border="0"
					class="buyinfor-table zx-addtable">
					<tr>
						<td align="right"><label class="control-label np">拖车时间：</label>
						</td>
						<td><input id="beg_time" name="submitTimeStart"
							placeholder="放贷日期" class="laydate-icon form-control"></td>
					</tr>

					<tr>
						<td align="right"><label class="control-label np">拖车地点：</label>
						</td>
						<td><input type="text" name="" id="" class="form-control"
							placeholder="拖车地点" /></td>
					</tr>
					<tr>
						<td align="right" valign="top"><label
							class="control-label np">退回备注：</label></td>
						<td><textarea id="remarks" name="remarks" cols="50" rows="5"
								type="text" class="form-control" aria-required="true"
								placeholder="请输入备注"></textarea></td>
					</tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0"
					bordercolor="#3B95C8" width="100%">
					<tr>
						<td width="100%" align="center">
							<div class="ibox-content">
								<button type="button" class="btn dpbtn_green"
									onclick="Updatesave();">确定</button>
								&nbsp;'
								<button type="button" class="btn dpbtn_red" onclick="Cancel();">取消</button>
							</div>
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>

	<!-- public quote -->
	<%@include file="/jsp/comm_js_include.jsp"%>

	<!-- jqGrid -->
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/jquery.jqGrid.min.js"></script>
	<script type="text/javascript" charset="utf-8"
		src="${basePath}/js/plugins/jqgriddemo/js/grid.locale-cn.min.js"></script>

	<!-- custom js -->
	<%@include
		file="/js/common-dpqc/dpqc-validate/comm_validate_include.jsp"%>


	<!-- layerDate plugin javascript -->
	<script src="${basePath}/js/plugins/layer/laydate/laydate.js"></script>
	<!--
    	作者：zhangpp
    	时间：2017-04-06
    	描述：js
    -->
	<script type="text/javascript">
		var winWidth = $(window).width();
		var winHeight = $(window).height();
		var lastSel;
	    jQuery(function($) { 
	    	laydate({
		        elem: '#beg_time', 
		        event: 'focus' 
		    });
	    	
	    	getData();
	    });
	   var importDueList=function(){
		   $.dpAjax({
	    		url:'${basePath}/DhOverdueController/batchImportDueList',
   				success: function(datas){
	    			  if(datas.flag == "100100")
					  {
						  layer.msg('执行成功！', {icon: 6});
						  return;
					  }
					  if(datas.flag == "100200")
	                  {
						  $.fn.showDatas({"datas":datas});
	                	  return;
	                  }
                }
	    	});
	   }
	    
	var getData = function(){
  	 var winWidth = $('div.ibox-content').width();
  	   	winHeight = $(window).height() / 2.5;
	    var win = winWidth / 7 - 20;
 	    $.jgrid.defaults.styleUI = 'Bootstrap';
		$("#table_list_1").jqGrid({
			url:'${basePath}/DhOverdueController/queryDueList',
	       	datatype : "json",
	        colNames : ['客户姓名','身份证号', '当前逾期','拖车原因', '贷款额','操作'],
		    colModel : [ 
	             {name: 'cusName',index: 'cusName',width: win,align: "center",sorttype: "float"},
	             {name: 'cusIdno',index: 'cusIdno',width: win,align: "center",sorttype: "float"},
	             {name: 'bankCode',index: 'bankCode',width: win,align: "center",sorttype: "float"},
	             {name: 'cardNo',index: 'cardNo',width: win,align: "center",sorttype: "float"},
	             {name: 'balanceCard',index: 'balanceCard',width: win,align: "center",sorttype: "float"},
	             {name:'Modify',index:'id',width:150,align:"left",width: win},
	             ],
	           mtype : "post",
	           height: winHeight,
	           width:winWidth,  
	           autowidth: false,
	           shrinkToFit: false,
	           rowNum: 15,
	            rowList: [15, 30, 45],
	           viewrecords: true,
	           pager: "#pager_list_1",
	           hidegrid: false,
	           multiselect : false,		//实现单选    multiboxonly:true   beforeSelectRow: true,
	           multiboxonly:false,  
	           beforeSelectRow: false,
	           altRows:true,
	           altclass:'someClass',
	           onSelectRow:function(id){
	         	  lastSel=id;
	           },
	           gridComplete:function(){  
                   var ids=jQuery("#table_list_1").jqGrid('getDataIDs');
                   for(var i=0; i<ids.length; i++){
                       var id=ids[i];   
                       modify = "<a href='#' class='btn dpbtn_green' onclick='overSee(" + id + ")'>详情</a>&nbsp;<a href='#' class='btn dpbtn_red' onclick='Success(" + id + ")'>成功</a>&nbsp;<a href='#' class='btn dpbtn_yellow' onclick='Failed(" + id + ")'>失败</a>&nbsp;<a href='#' class='btn dpbtn_red' onclick='Nodoit(" + id + ")'>不处理</a>";  
                       jQuery("#table_list_1").jqGrid('setRowData', ids[i], { Modify: modify});
                   }
               },
	           jsonReader: {
	                root: "result.rows",
	                page: "result.page",
	                total: "result.total",
	                records: "result.records",
	                repeatitems: false,
	                id: "id"
	            },
	            loadComplete:function(datas){
	          	  if (datas.flag == "100100") {
	                    layer.msg("查询成功!", {icon: 6, time: 1000});
	                    return;
	                }
	          	  if(datas.flag == '100802') {
	  				  top.location.href = thisLoginUrl;
	  				  return;
	  			  }

	          	  layer.msg(datas.message, {icon: 2});
	            }
	      });
	    }
	  	 //搜索
	var query = function(){
    	var cusName=$("#cusName").val();
    	
    	$("#table_list_1").jqGrid("setGridParam",{
    		url:'${basePath}/DhOverdueController/queryDueList',
  				postData:{
  		        	"cusName":cusName
  		        },
  				datatype:"json"
    	}).trigger("reloadGrid")
    }
    window.onresize = function()
    {
    	 $("#table_list_1").setGridWidth($(window).width()-80);
    	 $("#table_list_1").setGridHeight($(window).height() / 2.5);
    }
    var carSeriesChoose=function(){
    	
    }
	var carSeriesUnChoose=function(){
    	
    }
	
	//详情
	var overSee=function(){
    	alert('跳转客户总表')
    }
	
	//拖车成功
	var Success=function(){
		 window.location.href="trailerHandlingSuccess.jsp";   
    }
	
	//拖车失败
	function Failed(){
		layer.open({
			  title:'拖车失败记录',
			  type: 1,
			  area: ['550px', '400px'], //宽高
			  content: $('#contractDiv')
		});
	}
	
	//拖车失败保存
	var Updatesave = function(){

		layer.closeAll();
	}
	
	//拖车失败取消
	var Cancel = function(){
		layer.closeAll();
	}
	
	//不处理
	var Nodoit = function(){
		layer.confirm('确定放弃处理该客户？',{
			  title:'拖车申请处理',
			  btn: ['确认','取消'] //按钮
			}, function(){
				layer.closeAll();
				alert('执行ajax');
			},function(){
				layer.closeAll();
			});
    }
	
    </script>
</body>
</html>
